dg100: Speed is in kilometers per hour. Add patch from Eike and Mirko.
authoroliskoli <oliskoli>
Thu, 24 Apr 2008 21:09:27 +0000 (21:09 +0000)
committeroliskoli <oliskoli>
Thu, 24 Apr 2008 21:09:27 +0000 (21:09 +0000)
dg-100.c

index 6b69425066db322798b0fcd2641b1d5af8410f6c..0518578588425ab892d975a10a14c7f9f2d1a67a 100644 (file)
--- a/dg-100.c
+++ b/dg-100.c
@@ -246,7 +246,11 @@ process_gpsfile(gbuint8 data[], route_head *track)
                        bintime = be_read32(data + i +  8);
                        bindate = be_read32(data + i + 12);
                        wpt->creation_time = bintime2utc(bindate, bintime);
-                       wpt->speed = be_read32(data + i + 16) / 100.0;
+                       /* The device presents the speed as a fixed-point number
+                        * with a scaling factor of 100, in km/h.
+                        * The waypoint struct wants the speed as a
+                        * floating-point number, in m/s. */
+                       wpt->speed = KPH_TO_MPS(be_read32(data + i + 16) / 100.0);
                        wpt->wpt_flags.speed = 1;
                }